package com.cnhis.cloudhealth.clinical.clidoctor.acolsetting.service;

import java.io.Serializable;


import java.util.Map;
import java.util.concurrent.ConcurrentMap;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.alibaba.dubbo.config.annotation.Service;
 
import com.alibaba.fastjson.JSON;
import com.cnhis.cloudhealth.clinical.clidoctor.acolsetting.bo.IcolSettingBo;
import com.cnhis.cloudhealth.clinical.clidoctor.acolsetting.dao.IcolSettingDao;
import com.cnhis.cloudhealth.clinical.clidoctor.clibackadvice.bo.CliBackAdviceBo;
import com.cnhis.cloudhealth.clinical.clidoctor.clinewadvice.bo.CliNewAdviceBo;
import com.cnhis.cloudhealth.clinical.util.SpringUtilV3_prjcli;
import com.cnhis.cloudhealth.commons.Mappers.ModelVo;
import com.cnhis.cloudhealth.commons.newid.GetNewId;
import com.google.common.collect.Maps;


 
@SuppressWarnings("all")
@Service 
//@//Component  only for unit test
public class IcolSettingImpl implements IcolSetting {
	
	public static void main(String[] args) {
	//	serilizeUtil.seriz(new IcolSettingImpl(), "c:\\0log\\IcolSettingImpl.txt");
	//	System.out.println("--");
		SpringUtilV3_prjcli.cfgFileDir="C:\\Users\\attilax\\Desktop\\springtest_cli";				
		SpringUtilV3_prjcli.setLocations("applicationContext-datasource.xml,onehis-dubbo.xml");
 
		IcolSettingImpl bean=	(IcolSettingImpl) SpringUtilV3_prjcli.getBean( IcolSettingImpl.class);
	 
		ConcurrentMap<String, Object> newConcurrentMap = Maps.newConcurrentMap();
		newConcurrentMap.put("key", "key1");newConcurrentMap.put("val", "val1");
	//	System.out.println(d.setSetting(newConcurrentMap));
		bean.setSetting("col_show_setting", "{'c1':'show','c2','hide'}");
		System.out.println(JSON.toJSONString(bean.getSetting_str("col_show_setting"))  );
		
		
 
	}
	
	public IcolSettingImpl() {
		// TODO Auto-generated constructor stub
	}
	@Autowired
	private IcolSettingBo IcolSettingBo1;
 
	
	
	public Object setSetting(String key,String val) {
		 
		 Map map=Maps.newHashMap();
		 map.put("key", key);map.put("val",val);
		 return setSetting(map);
	}
 
	 
	@Override
	public Object setSetting(Map map) {
		 
		return IcolSettingBo1.setSetting(map);
	}
	
	@Override
	public Object getSetting(Map map) {
		// TODO Auto-generated method stub
		return IcolSettingBo1.getSetting(map);
	}

	@Override
	public Object getSetting_str(String key) {
 
		Map map =Maps.newHashMap();
		map.put("key", key);
		Object setting = getSetting(map);
		return  setting;
 
	}
	 
    
	
}
